﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;
using YAPL.Language.Ast.Utils;

namespace YAPL.Test.YAPL.Language.Ast.Utils {
	public class DescendantAttributeTest {
		[Fact]
		public void DescendantAttributePriorityComparerShouldWorkCorrectly() {
			var comparer = new DescendantAttributePriorityComparer();
			var attr1 = new DescendantAttribute(AstVisit.AfterCurrent) {Priority = 1};
			var attr2 = new DescendantAttribute(AstVisit.AfterCurrent) {Priority = 2};
			Assert.True(comparer.Compare(attr1,attr2) > 0);
			attr1.Priority = 2;
			Assert.True(comparer.Compare(attr1,attr2) == 0);
			attr1.Priority = 3;
			Assert.True(comparer.Compare(attr1, attr2) < 0);
		}
	}
}
